<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="pl">  
    <head>

        <jsp:include page="./../util/configurationPage.jsp"/>


        <style type="text/css">
            #inner {
                display: table;
                margin: 0 auto;
            }

            #activeEx {
                background-color : #5CB85C;
                color:#ffffff;
                border: 1px;

            }
        </style>


        <script type="text/javascript">
            $(window).on('load', function() {

                $('.selectpicker').selectpicker();

                // $('.selectpicker').selectpicker('hide');
            });
        </script>
    </head>
    <body>
        <jsp:include page="./../navbar/navbarMain.jsp"/>
        <br>

        <div class="container ">
            <div class="col-lg-12">
                <div class="row">
                    <div class="col-lg-3">
                        <jsp:include page="./../navbar/menuBar.jsp"/>
                    </div>
                    <div class="col-lg-9">
                        <div class="panel panel-success">

                            <div class="panel-heading">
                                <h3 class="panel-title">Lista produktów</h3>
                            </div>
                            <div class="panel-body">
                                <table class="table">
                                    <tbody>

                                        <c:if test="${emptySearchResult eq true}">
                                        <div class="alert alert-info">Nie znaleziono żadnych produktów spełniających zadane kryteria</div>
                                    </c:if>
                                    <c:if test="${emptySearchResult eq false}">
                                        <c:forEach items="${productList}" var="product">
                                            <tr class="default">
                                                <td> <div class="media">
                                                        <a class="pull-left" href="details.htm?id=${product.id}">
                                                            <img class="media-object" data-src="holder.js/64x64" alt="64x64" style="width: 64px; height: 64px;" src="data:image/jpeg;base64,${product.image}">
                                                        </a>
                                                        <div class="pull-right"><h4><span class="label label-info">${product.cost} zł</span></h4></div>      
                                                        <div class="media-body">
                                                            <a  href="details.htm?id=${product.id}"><h4 class="media-heading">${product.name}</h4> </a>
                                                            ${product.description}
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </c:forEach>

                                    </c:if>                          

                                    </tbody>
                                </table>
                                <br>

                                <c:if test="${emptySearchResult eq false}">
                                    <ul id="inner" class="pagination">
                                        <c:forEach items="${pageList}" var="page">
                                            <li class="${page.style}"><a href="${page.link}">${page.number}</a></li>
                                            </c:forEach>
                                    </ul>
                                </c:if>

                            </div>
                        </div>
                    </div>
                </div>  
            </div>
        </div>


        <jsp:include page="./../util/footer.jsp"/>
    </body>
</html>
